package com.mc.fastkit.view

/**
 * StateType
 * @author: MasterChan
 * @date: 2025-05-07 14:57
 */
sealed class StateType(value: Int) {

    companion object {
        fun from(value: Int): StateType {
            return when (value) {
                0 -> NONE
                1 -> PRESSED
                2 -> SELECTED
                3 -> CHECKED
                else -> NONE
            }
        }
    }

    val androidState: Int
        get() {
            return when (this) {
                PRESSED -> android.R.attr.state_pressed
                SELECTED -> android.R.attr.state_selected
                CHECKED -> android.R.attr.state_checked
                else -> 0
            }
        }

    data object NONE : StateType(0)
    data object PRESSED : StateType(1)
    data object SELECTED : StateType(2)
    data object CHECKED : StateType(3)
}